import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutterapp/Base/redux/AppState.dart';
import 'package:flutterapp/UniqueIDUtil.dart';
import 'package:redux/redux.dart';

enum PUBLISHING_ENVIRONMENT { DEV, QA, PRO }

class Global {
  static var ENV;
  static AppState appState;
  static Store appStore;
  static String BASE_API_HOST = "";

//  todo baseURL 发布环境
  static const String _DEV_API_HOST = "";
  static const String _PRO_API_HOST = "";

  static Future initApp() async {
//    TODO 修改发布环境
    ENV = PUBLISHING_ENVIRONMENT.DEV;

    switch (ENV) {
      case PUBLISHING_ENVIRONMENT.DEV:
        BASE_API_HOST = _DEV_API_HOST;
        break;
      case PUBLISHING_ENVIRONMENT.QA:
        break;
      case PUBLISHING_ENVIRONMENT.PRO:
        BASE_API_HOST = _PRO_API_HOST;
        break;
    }
    //初始化redux
    appState = new AppState();
    appStore = new Store<AppState>(reducer, initialState: appState);

    await UniqueIDUtil.getDeviceInfo();
  }
}
